package com.mmall.concurrency.example.threadPool;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

/**
 * Created by RID on 2018/4/15.
 */
@Slf4j
public class ThreadPoolExample4 {
    public static void main(String[] args) {
        ScheduledExecutorService executorService=Executors.newScheduledThreadPool(5);

        for (int i =0; i<10; i++){
            executorService.scheduleAtFixedRate(()->{
                log.info("scheduled task");
            },1,3, TimeUnit.SECONDS);
        }
    }

}
